<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <META NAME="Title" CONTENT="SMS Server Tools 3">
    <META NAME="Robots" CONTENT="INDEX,FOLLOW">
    <META NAME="Language" CONTENT="English">
    <title>SMS Server Tools 3</title>
<STYLE type="text/css">
BODY {
  BACKGROUND: #ffffff; MARGIN: 5px 5px 10px; FONT: 10pt verdana, geneva, lucida, arial, helvetica, sans-serif; COLOR: #000000
}
td {
  FONT: 10pt verdana, geneva, lucida, arial, helvetica, sans-serif;
}
h3 {
  background-color: #DCDCFE;
}
blockquote {
  background-color: #FFD;
  font-size: 90%;
  padding:5pt;
  padding-top:1pt;
  margin-bottom:5pt;
  border-style: outset;
  border-color: #aaaa99;
  border-width: 0.05pt 2pt 2pt 0.05pt;
}
blockquote p:first-letter {
  font-size: 110%;
  font-weight: bold;
  color: red;
}
</STYLE>
  </head>

<body>
<h2><font color=blue><a href="http://smstools3.kekekasvi.com">SMS Server Tools 3</a></font></h2>
<a href="index.html">Home</a>
<h3>Eventhandler</h3>
<!-- START --><p>
The eventhandler is a program or script, that smsd runs, whenever it
receives or sent a message or when it was not able to send a message.
</p>
<p>
Smsd calls the script after it has moved the file from the provider
queue into the failed or sent queue.
</p>
<p>
Smsd gives two or three arguments to the eventhandler. The first one is SENT, RECEIVED, FAILED, REPORT or CALL. 
The second one is the SMS file filename. 
The third argument is the message id of the SENT message, it is only used if you sent a message
successfully with status report enabled.
</p>
<p>
There is an example script in scipts/smsevent.
</p>
<p>
If you use UTF-8 character set as a locale, you might want to use eventhandler to convert received messages
from ISO character set (which is internally used by the smsd) to UTF-8. See scripts/eventhandler-utf-8 for details.
Also you can use the <b>checkhandler</b> to convert outgoing messages from UTF-8 to ISO, 
see scripts/checkhandler-utf-8 for code sample. 
</p>

<h3>Alarm handler</h3>
The alarm handler is a program that smsd runs whenever an error occures.
<p>
See <a href="error-messages.html">this</a> document for possible error messages.
<p>
Smsd gives the following arguments to the alarmhandler:
<p>
<ul>
  <li>the keyword ALARM</li>
  <li>a date in the format yyyy-mm-dd</li>
  <li>a time in the format hh:mm:ss</li>
  <li>the alarm severity (1 digit number)</li>
  <li>the modem name or SMSD</li>
  <li>the alarm text</li>
</ul>
 <p>
 Example:
<p><font face="Courier New, Courier, monospace">
#!/bin/sh<br>
# This is an example how to use an alarm handler with smsd.<br>
echo SMSD alarm: $5 $6<br></font>
<p>
This script displays a message for each alarm.

<p>&nbsp;</p>
<blockquote><p>
The <a href="book.html" target="_blank">book</a> describes how to use eventhandler to do different things automatically, like
forwarding to eMail, storing received messages and status report into SQL database, running a self-test, publishing
received messages with a webserver and more.
</p>
<p> 
<small>The book is about the version 2.x and written, maintained and owned by Stefan Frings.</small>
</p></blockquote>

<hr>
</body>
</html>
